package com.byght.bygsystem.service;

import com.byght.bygsystem.mapper.TransactionMapper;
import com.byght.bygsystem.model.Transaction;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TransactionService {
    private final TransactionMapper transactionMapper;

    public TransactionService(TransactionMapper transactionMapper) {
        this.transactionMapper = transactionMapper;
    }

    public Transaction getTransactionById(int id) {
        return transactionMapper.getTransactionById(id);
    }

    public List<Transaction> getAllTransactions() {
        return transactionMapper.getAllTransactions();
    }

    public void insertTransaction(Transaction transaction) {
        transactionMapper.insertTransaction(transaction);
    }

    public void updateTransaction(Transaction transaction) {
        transactionMapper.updateTransaction(transaction);
    }

    public void deleteTransaction(int id) {
        transactionMapper.deleteTransaction(id);
    }
}
